9ef5fa483d15ae2916ede4aed3776ffa4fec37e2,samigo/samigo-app/src/java/org/sakaiproject/jsf/renderer/RichTextEditArea.java,RichTextEditArea,encodeFCK,#ResponseWriter#String#String#String#String#String#String#boolean#String#,392
Before Change
writer.write("<script type=\"text/javascript\" language=\"JavaScript\">\n");
writer.write("function chef_setupformattedtextarea(client_id,shouldToggle){\n");
writer.write("\tvar textarea_id = client_id + \"_textinput\";\n");
//if toggling is on, hide the toggle when the user goes to richText
writer.write("\tif(shouldToggle){\n");
After Change
writer.write("<textarea name=\"" + clientId + "_textinput\" id=\"" + clientId + "_textinput\" rows=\""+ textBoxRows + "\" cols=\""+ textBoxCols + "\" class=\"simple_text_area\">");
writer.write((String) value);
writer.write("</textarea>");
writer.write("<input type=\"hidden\" name=\"" + clientId + "_textinput_current_status\" id=\"" + clientId + "_textinput_current_status\" value=\"firsttime\">");
writer.write("\n\t<script type=\"text/javascript\" src=\"" + FCK_BASE + FCK_SCRIPT + "\"></script>");
writer.write("<script type=\"text/javascript\" language=\"JavaScript\">\n");
writer.write("\nfunction show_hide_editor(client_id){");
writer.write("\n\tvar status = document.getElementById(client_id + '_textinput_current_status');");
writer.write("\n\tif (status.value == \"firsttime\") {");
writer.write("\n\t\tstatus.value = \"expaneded\";");
writer.write("\n\t\tchef_setupformattedtextarea(client_id, true);\n\t}");
writer.write("\n\telse if (status.value == \"collapsed\") {");
writer.write("\n\t\tstatus.value = \"expaneded\";");
writer.write("\n\t\texpandMenu(client_id);\n\t}");
writer.write("\n\telse if (status.value == \"expaneded\") {");
writer.write("\n\t\tstatus.value = \"collapsed\";");
writer.write("\n\t\tcollapseMenu(client_id);\n\t}");
writer.write("\n}\n");
writer.write("function chef_setupformattedtextarea(client_id,shouldToggle){\n");
writer.write("\tvar textarea_id = client_id + \"_textinput\";\n");
//if toggling is on, hide the toggle when the user goes to richText
//writer.write("\tif(shouldToggle){\n");
//writer.write("\t\tvar toggle_id = client_id + \"_toggle\";\n");
//writer.write("\tvar oToggleDiv = document.getElementById(toggle_id);\n");
//writer.write("\toToggleDiv.style.display=\"none\";\n");
//writer.write("\t}\n");
writer.write("var oFCKeditor = new FCKeditor(textarea_id);\n");
writer.write("\n\toFCKeditor.BasePath = \"" + FCK_BASE + "\";");
writer.write("\n\toFCKeditor.Height = " + outRow + ";");
writer.write("\n\n\toFCKeditor.Width = " + outCol + ";");
if ( (justArea != null) && (justArea.equals("yes")))
{
writer.write("\n\toFCKeditor.ToolbarSet = \"plain\";");
}
else
{
String connector = "/sakai-fck-connector/web/editor/filemanager/browser/default/connectors/jsp/connector";
String collectionId = ContentHostingService.getSiteCollection(ToolManager.getCurrentPlacement().getContext());
if ("archival".equals(ServerConfigurationService.getString("tags.focus")))
writer.write("\n\toFCKeditor.Config['CustomConfigurationsPath'] = \"/library/editor/FCKeditor/archival_config.js\";\n");
else {
writer.write("\n\t\tvar courseId = \"" + collectionId + "\";");
writer.write("\n\toFCKeditor.Config['ImageBrowserURL'] = oFCKeditor.BasePath + " +
"\"editor/filemanager/browser/default/browser.html?Connector=" + connector + "&Type=Image&CurrentFolder=\" + courseId;");
writer.write("\n\toFCKeditor.Config['LinkBrowserURL'] = oFCKeditor.BasePath + " +
"\"editor/filemanager/browser/default/browser.html?Connector=" + connector + "&Type=Link&CurrentFolder=\" + courseId;");
writer.write("\n\toFCKeditor.Config['FlashBrowserURL'] = oFCKeditor.BasePath + " +
"\"editor/filemanager/browser/default/browser.html?Connector=" + connector + "&Type=Flash&CurrentFolder=\" + courseId;");
writer.write("\n\toFCKeditor.Config['ImageUploadURL'] = oFCKeditor.BasePath + " +
"\"" + connector + "?Type=Image&Command=QuickUpload&Type=Image&CurrentFolder=\" + courseId;");
writer.write("\n\toFCKeditor.Config['FlashUploadURL'] = oFCKeditor.BasePath + " +
"\"" + connector + "?Type=Flash&Command=QuickUpload&Type=Flash&CurrentFolder=\" + courseId;");
writer.write("\n\toFCKeditor.Config['LinkUploadURL'] = oFCKeditor.BasePath + " +
"\"" + connector + "?Type=File&Command=QuickUpload&Type=Link&CurrentFolder=\" + courseId;");
writer.write("\n\n\toFCKeditor.Config['CurrentFolder'] = courseId;");
writer.write("\n\toFCKeditor.Config['CustomConfigurationsPath'] = \"/library/editor/FCKeditor/config.js\";\n");
}
}
writer.write("\n\n\toFCKeditor.ReplaceTextarea();\n\t}\n");
writer.write("\nfunction collapseMenu(client_id){");
writer.write("\n\tvar editor = FCKeditorAPI.GetInstance(client_id + '_textinput');");
writer.write("\n\teditor.ToolbarSet.Collapse();");
writer.write("\n}\n");
writer.write("\nfunction expandMenu(client_id){");
writer.write("\n\tvar editor = FCKeditorAPI.GetInstance(client_id + '_textinput');");
writer.write("\n\teditor.ToolbarSet.Expand();");
writer.write("\n}\n");
writer.write("</script>\n");